<script type="text/javascript">
    $(document).ready(function(){
        $("#save_template_btn").click(function(){
            // action url
            var url = window.location.href + '/saveconfig';
            // template name
            var name = $("#template_name").val();
            // post
            $.post(url, {configName: name, configString:dimensionString}, function(data){
                if(data.length < 1){
                    alert("Done!");
                }else{
                    alert("Error: "+data);
                }
            });
        });
        $("#close-results").click(function(){
            $("#import-options").remove();
        });
        $("#extract_triples_btn").click(function(){
            $("#import-options").html("<h1>Please wait..</h1>");
            $("#import-options").css("font-size", "10");
            $("#import-options").css("height", "500px");
            var done = false;
            var updater = window.setInterval(function(){
                $.get("extensions/components/csvimport/logs/importer.log", function(data){
                    $("#import-options").html(data.replace(/\n/g, "<br/>"));
                });
                if(done){
                    window.clearInterval(updater);
                };
            }, 5000);
            $.post(actionURL, {dimensions: dimensionString}, function () {
                //alert('Success');
                done = true;
            });
        })
    })
</script>
<div align="center" style="height: 100%; vertical-align: middle; overflow: auto;">
    <b>Import options.</b><br/>
    <input type="text" id="template_name" value="Template Name" /><br/>
    <input type="button" id="save_template_btn" value="Save Template" onclick="" /><br/>
    <input type="button" id="extract_triples_btn" value="Extract triples" onclick="" /><br/>
    <div style="width:100%; text-align: right;"><a href="#" onclick="return false;" id="close-results">[x]</a></div>
</div>